Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a benchmark on individual Unicode codepoints reading/writing #320

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

fzhinkin
Copy link
Collaborator

@fzhinkin fzhinkin commented May 8, 2024

No description provided.

@fzhinkin fzhinkin requested a review from shanshin May 8, 2024 15:20
@fzhinkin fzhinkin added NFC Non functional change benchmarks labels May 8, 2024

// Encoding names follow naming from Utf8StringBenchmark
@Param("ascii", "utf8", "sparse", "2bytes", "3bytes", "4bytes", "bad")
var encoding: String = "ascii"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's better to use enum in such cases?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to use the same values as for the old read/writeString benchmark. I can replace the parameter with enum, but then the old value need to be replaced (especially 2|3|4bytes), and that would complicate results comparison against older releases.

}

when (encoding) {
"ascii" -> codePoints.fill { Random.nextInt(' '.code, '~'.code) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are codes less than 0x20 ignored?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a personal preference :)

@fzhinkin fzhinkin merged commit 80cbdd8 into develop Jun 12, 2024
1 check passed
@fzhinkin fzhinkin deleted the codepoint-rw-benchmarks branch June 12, 2024 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
benchmarks NFC Non functional change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants